package com.gaofeng.day19;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class demo03 {
    public static void main(String[] args) {
        HashMap<Student,String> student= new HashMap<>();
        Student stu1 = new Student("zs",23);
        Student stu2 = new Student("lisi",35);
        Student stu3 = new Student("wangwu",36);

        student.put(stu1,"张三");
        student.put(stu2,"李四");
        student.put(stu3,"王五");
        System.out.println(student);

        Set<Student> stu = student.keySet();
        for (Student student1 : stu) {
            System.out.println(student1);
        }

        Set<Map.Entry<Student, String>> entries = student.entrySet();
        entries.forEach(s -> {
            System.out.println(s + ":");
        });

    }
}
